package com.xigua._数学;

/**
 * @author LiRongHua
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2022/4/814:58
 */
public class _1281_整数的各位积和之差 {

    public static void main(String[] args) {
        System.out.println(Integer.valueOf('0'));
    }

    public int subtractProductAndSum(int n) {
        String s = String.valueOf(n);
        char[] numChar = s.toCharArray();
        int sum = 0;
        int product = 1;
        for (char c : numChar) {
            int num =c- 48;
            sum +=num;
            product *=num;
        }
        return product-sum;
    }
}
